
package com.caration.shell.action;

import com.caration.shell.R;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class ArrayListFragment extends ListFragment {

    int mNum;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mNum = getArguments() != null ? getArguments().getInt("num") : 1;
    }

    /**
     * Create a new instance ofCountingFragment, providing "num" as an argument.
     */
    static ArrayListFragment newInstance(int num) {
        ArrayListFragment f = new ArrayListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("num", num);
        f.setArguments(bundle);
        return f;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_pager_list, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setListAdapter(ActionProvider.getListAdapter(mNum));
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        ActionProvider.onItemClick(mNum, position);
    }
}
